package com.cq.hd.product.api;

import com.cq.hd.common.pagination.Page;
import com.cq.hd.common.response.Result;
import com.cq.hd.product.api.dto.*;
import com.cq.hd.product.api.vo.GoodsActivePageVo;
import com.cq.hd.product.api.vo.GoodsCountVo;
import com.cq.hd.product.api.vo.GoodsPageVo;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.cloud.openfeign.SpringQueryMap;
import org.springframework.web.bind.annotation.*;

import java.util.List;

@FeignClient(value = "hd-o2o-product-service", contextId = "goods-api")
public interface TbGoodsApi {

    // 列表
    @GetMapping("/product/goods/pageGoods")
    Result<Page<GoodsPageVo>> pageGoods(@SpringQueryMap GoodsPageDto goodsPageDto);

    // 发布
    @PostMapping("/product/goods/releaseGoods")
    Result<Object> releaseGoods(@RequestBody GoodsReleaseDto goodsReleaseDto);

    // 批量下架
    @PutMapping("/product/goods/offGoods")
    Result<Object> offGoods(@RequestBody GoodsOffDto goodsOffDto);

    // 批量上架
    @PutMapping("/product/goods/batchOnGoods")
    Result<Object> batchOnGoods(@RequestBody GoodsOnDto goodsOnDto);

    // 上架
    @PutMapping("/product/goods/onGoods")
    Result<Object> onGoods(@RequestBody GoodsOnDto goodsOnDto);

    // 改库存
    @PutMapping("/product/goods/updateGoodsStock")
    Result<Object> updateGoodsStock(@RequestBody GoodsStockUpdateDto goodsStockUpdateDto);

    // 改价
    @PutMapping("/product/goods/updateGoodsPrice")
    Result<Object> updateGoodsPrice(@RequestBody GoodsPriceUpdateDto goodsPriceUpdateDto);

    // 编辑
    @PutMapping("/product/goods/updateGoods")
    Result<Object> updateGoods(@RequestBody GoodsUpdateDto goodsUpdateDto);

    // 删除
    @DeleteMapping("/product/goods/deleteGoods")
    Result<Object> deleteGoods(@RequestParam("id") Long id, @RequestParam("merchantId") Long merchantId);

    @DeleteMapping("/product/goods/deleteBusinessMerchantGoods")
    Result<Object> deleteBusinessMerchantGoods(@RequestParam("id") Long id, @RequestParam("businessMerchantId") Long businessMerchantId);

    // 批量删除
    @DeleteMapping("/product/goods/batchDeleteGoods")
    Result<Object> batchDeleteGoods(@RequestBody GoodsDelDto goodsDelDto);

    // 创建活动选择商品列表
    @GetMapping("/product/goods/pageGoodsActive")
    Result<Page<GoodsActivePageVo>> pageGoodsActive(@SpringQueryMap GoodsActivePageDto goodsActivePageDto);

    // 根据商户id获取在售商品数
    @GetMapping("/product/goods/onGoodsCount")
    Result<Integer> onGoodsCount(@RequestParam("merchantId") Long merchantId);

    // 根据商户id获取商品每个状态的个数
    @GetMapping("/product/goods/getGoodsCount")
    Result<List<GoodsCountVo>> getGoodsCount(@RequestParam("merchantId") Long merchantId);

    // 根据商户id获取该商户（策划人）为底下商户添加的商品每个状态的个数
    @GetMapping("/product/goods/getBusinessMerchantGoodsCount")
    Result<List<GoodsCountVo>> getBusinessMerchantGoodsCount(@RequestParam("merchantId") Long merchantId);

    // 扫描已上架的商品的库存,如果低于5，发送系统通知给商户
    @PostMapping("/product/goods/scanOnGoodsStock")
    Result<Boolean> scanOnGoodsStock();
}
